/**
 * Created by 86135 on 2020/2/19.
 */
public class Test12 {
    public static void main(String[] args) {

        int[][] arr = {{0,0,0,0,0,0,0,0,0,0,0},
                {0,0,1,0,0,0,0,0,0,0,0},
                {0,0,0,2,0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0,0,0,0,0},
                {0,0,0,0,0,2,0,0,0,0,0},
                {0,0,0,0,0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0,0,0,0,0},
                {0,0,0,0,0,0,0,0,0,0,0},};
        int[][] aaa = showtime(arr);
        for (int i = 0; i < aaa.length; i++) {
            for (int j = 0; j < aaa[i].length; j++) {
                System.out.print(aaa[i][j]+" |");
            }
            System.out.println();
        }

    }
    public static int[][] showtime(int[][] arr){

        int a = 0;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if (arr[i][j] != 0){
                    a++;
                }
            }
        }
        int[][] aaa = new int[a+1][3];
        aaa[0][0] = arr.length;
        aaa[0][1] = arr[0].length;
        aaa[0][2] = a;
        int sy = 1;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if (arr[i][j] == 0){

                }else {
                    aaa[sy][0] = arr[i][j];
                    aaa[sy][1] = i;
                    aaa[sy][2] = j;
                    sy++;
                }
            }
        }
        return aaa;
    }
}
